<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <!-- 已知⼀个数组序列，全部为正整数，找出其中任意两个数相差最⼤的组合 -->
</head>
<body>
  <script>
    var arr = [1,2,3,4,5,6,7,8,9];
    var max = arr[0];
    var min = arr[0];;
    var res = [];
    for(let i = 0; i < arr.length; i++){
      if(arr[i] > max){
        max = arr[i];
      }else{
         min = arr[i]
      }
    }
    res.push(max,min)
    console.log(res);
  </script>
</body>
</html>